package com.tandong.multidatasource.service;

import com.tandong.multidatasource.entity.User;
import com.tandong.multidatasource.mapper.db1.UserMapper1;
import com.tandong.multidatasource.mapper.db2.UserMapper2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @description: test
 * @author: tandong
 * @create: 2019-12-06 15:06
 **/
@Service
public class TestService {

    @Autowired
    UserMapper1 userMapper1;
    @Autowired
    UserMapper2 userMapper2;

    @Transactional
    public void test() {
        User user1 = new User();
        user1.setId(2);
        user1.setName("aaa");
        userMapper1.insert(user1);

        User user2 = new User();
        user2.setId(1);
        user2.setName("bbb");
        userMapper2.updateById(user2);

//        Integer.parseInt("abc");

    }

}
